home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_aet_getdilator.cog < prev    next >
Text File  |  1999-11-15  |  6KB  |  249 lines

  1. # Jones 3D Cog Script
  2. #
  3. # aet_GetDilator.cog
  4. #
  5. # [RT] [TL]
  6. #
  7. # (C) 1998 LucasArts Entertainment Company LLC. All Rights Reserved
  8. #
  9. # ===================================================================
  10.  
  11. symbols
  12.  
  13. message     startup
  14. message        activated
  15. message        callback
  16. message        timer
  17. message        entered
  18. message        exited
  19.  
  20. # Change these variables ONLY!
  21. # -------------------------------------------------------------------
  22.  
  23. # Use in_pickup_low or in_pickup_med or in_reach_high.key for the "get" keyframe
  24. keyframe    get=in_pickup_med.key    local
  25.  
  26. # Item-specific voice line
  27. sound        foundSnd=INXJ205.wav    local
  28.  
  29. # Item bin number
  30. int            bin=18                    local
  31.  
  32. # Added for level specific item
  33. thing        moveImp5
  34.  
  35. thing        origin0                                                # Lightning targets.
  36. thing        target0
  37. thing        lightThing                                            # Dynamic pulseing light.
  38. thing        offsetTarget0                                        # Camera offset targets.
  39. thing        offsetTarget1                                        
  40. thing        offsetTarget2                                        
  41. thing        offsetTarget3                                        
  42.  
  43. surface        surface0                                            # Surfaces to check to see where he is.
  44. surface        surface1                                            
  45. surface        surface2                                            
  46. surface        surface3                                            
  47.  
  48. material    lightningmat0=aet_4sfx_lightning_v2_a.mat    local    # Mats for lightning.
  49. material    lightningmat1=aet_4sfx_lightning_v2_b.mat    local
  50. material    lightningmat2=aet_4sfx_lightning_v2_c.mat    local
  51. material    lightningmat3=aet_4sfx_lightning_v2_d.mat    local
  52. material    lightningmat4=aet_4sfx_lightning_v2_e.mat    local
  53.  
  54. sound        strike0=aet_lightning_01.wav                local
  55. sound        strike1=aet_lightning_02.wav                local
  56. sound        strike2=aet_lightning_03.wav                local
  57. sound        strike3=aet_lightning_04.wav                local
  58.  
  59. int            cnt                                            local
  60. int            onSurf0=0                                    local    # Toggles for knowing which surface he is on.
  61. int            onSurf1=0                                    local
  62. int            onSurf2=0                                    local
  63. int            onSurf3=0                                    local
  64. int            pickupDone=0                                local
  65. int            strikechannel                                local
  66. int            randnum                                        local
  67. int            inCallback=0                                local
  68.  
  69. sound        fade=nub_charged_pad_c.wav                    local
  70.  
  71. thing        player                                        local
  72.  
  73. int            returnVal                                    local    # (temp) value for testing...            
  74.  
  75. sound        charge=aet_mr_chargeup.wav                    local                
  76. template    sparks0=mophiaSparksLg                        local
  77.  
  78. end
  79.  
  80. # ===================================================================
  81. code
  82.  
  83. startup:
  84.  
  85. player = GetLocalPlayerThing();
  86. # Hiding the dynamic light for now.
  87. SetThingFlags(lightThing, 0x80000);
  88. # Setting timer for lightning.
  89. SetTimer(1.0);
  90.  
  91. return;
  92.     
  93. # ........................................................................................
  94. entered:
  95.  
  96. if (pickupDone == 1) return;
  97. # Setting toggles for which surface Indy is on.
  98. if (GetSenderRef() == surface0)
  99.     {
  100.     onSurf0 = 1;
  101.     }
  102. if (GetSenderRef() == surface1)
  103.     {
  104.     onSurf1 = 1;
  105.     }
  106. if (GetSenderRef() == surface2)
  107.     {
  108.     onSurf2 = 1;
  109.     }
  110. if (GetSenderRef() == surface3)
  111.     {
  112.     onSurf3 = 1;
  113.     }
  114.  
  115. return;
  116.     
  117. # ........................................................................................
  118. exited:
  119.  
  120. if (pickupDone == 1) return;
  121. # Setting toggles for when Indy leaves these surfaces.
  122. if (GetSenderRef() == surface0)
  123.     {
  124.     onSurf0 = 0;
  125.     }
  126. if (GetSenderRef() == surface1)
  127.     {
  128.     onSurf1 = 0;
  129.     }
  130. if (GetSenderRef() == surface2)
  131.     {
  132.     onSurf2 = 0;
  133.     }
  134. if (GetSenderRef() == surface3)
  135.     {
  136.     onSurf3 = 0;
  137.     }
  138.  
  139. return;
  140.  
  141. # ........................................................................................
  142. activated:
  143.  
  144. if (GetSenderRef() != moveImp5) return;
  145.  
  146. if (pickupDone == 1) return;
  147. pickupDone = 1;
  148.  
  149. SetTimer(0.0);
  150.  
  151. StartCutscene(0);
  152.  
  153. # Disable player controls and stuff
  154. if (MakeMeStop() == -1)
  155.     return;
  156. DeselectWeaponWait(player);    
  157.  
  158. # Capture player so we get callback message
  159. CaptureThing(player);
  160. # Start the animation
  161. returnVal = PlayKey(player, get, 5, 0x12, 0); 
  162.  
  163. # Set up the camera
  164. if (onSurf0 == 1)
  165.     {
  166.     SetExtCamOffsetToThing(offsetTarget0);
  167.     }
  168. if (onSurf1 == 1)
  169.     {
  170.     SetExtCamOffsetToThing(offsetTarget1);
  171.     }
  172. if (onSurf2 == 1)
  173.     {
  174.     SetExtCamOffsetToThing(offsetTarget2);
  175.     }
  176. if (onSurf3 == 1)
  177.     {
  178.     SetExtCamOffsetToThing(offsetTarget3);
  179.     }
  180.  
  181. return;
  182.  
  183. # ........................................................................................
  184. callback:
  185.  
  186. if (inCallback == 1) return;
  187. inCallback = 1;
  188.  
  189. ReleaseThing(player);
  190.  
  191. # Get rid of the item
  192. PlaySoundLocal(charge, 0.2, 0, 0x0, 0);
  193. CreateThing(sparks0, moveImp5);
  194.  
  195. DestroyThing(moveImp5);
  196. moveImp5 = -1;
  197.  
  198. PlaySoundLocal(fade, 1.0, 0, 0x0000, 0);
  199.  
  200. # Add to inventory
  201. ChangeInv(player, bin, 1.0);
  202. SetInvAvailable(player, bin, 1);
  203. JonesInvItemChanged(bin);
  204.  
  205. # Wait a bit, then start the voice line
  206. Sleep(1.0);
  207. PlayVoice(player, foundSnd, 1.0, 0);
  208.  
  209. # Reset the camera
  210. RestoreExtCam();
  211.  
  212. # Enable player control
  213. ClearActorFlags(player, 0x200000);
  214.  
  215. EndCutscene();
  216.  
  217. return;
  218.  
  219. # ........................................................................................
  220. timer:
  221.  
  222. if (moveImp5 == -1) 
  223.     {
  224.     return;
  225.     }
  226. # Code for lightning and light pulse.
  227. randnum = RandBetween(0, 3);
  228. ClearThingFlags(lightThing, 0x80000);
  229. strikechannel = PlaySoundThing(strike0[randnum], target0, 0.5, 2.5, 5.0, 0);
  230.     for (cnt = 2; cnt <= RandBetween(2, 5); cnt = cnt + 1)
  231.         {
  232.         CreatePolylineThing(origin0, target0, '0 0 0', lightningmat0[RandBetween(0, 4)], 0.05, 0.05, 0.05);
  233.         if (onSurf0 == 1)
  234.             {
  235.             # If player is standing on hot spot, then hit him with lightning.
  236.             DamageThing(player, 10, 0x1, surface0);    # NOTE: this code causes a "stack" bug...fix later...
  237.             }
  238.         Sleep(0.05);
  239.         }
  240. SetTimer(Rand() * 1.5);
  241. SetThingFlags(lightThing, 0x80000);
  242. //StopSound(strikechannel, 0);
  243.  
  244. return;
  245.  
  246. # ........................................................................................
  247. end
  248.  
  249.